<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// Route::rule('路由表达式','路由地址','请求类型','路由参数(数组)','变量规则(数组)')
//只要定义了路由就只能以路由的方式访问

use think\Route;

//定义路由
// //后台登录页  login
// Route::any('login', 'admin/loginl/login', ['ext'=>'html']);
// //后台商品列表
// Route::any('goods', 'admin/goods/index', ['ext'=>'html']);
// //后台商品新增
// Route::get('goods_create', 'admin/goods/create', ['ext'=>'html']);
// //后台商品新增->保存
// Route::post('goods_save', 'admin/goods/save', ['ext'=>'html']);
// //后台商品修改
// Route::get('goods_edit/:id', 'admin/goods/edit', ['ext'=>'html'], ['id'=>'\d+']);
// //后台商品修改->保存
// Route::post('goods_update', 'admin/goods/update', ['ext'=>'html'], ['id'=>'\d+']);
// //后台商品详情
// Route::get('goods_read/:id', 'admin/goods/read', ['ext'=>'html'], ['id'=>'\d+']);
// // Route::rule('goods_read/:id', 'admin/goods/read', 'GET', ['ext'=>'html'], ['id'=>'\d+']);   //效果一样
// //后台商品删除
// Route::get('goods_delete/:id', 'admin/goods/delete', ['ext'=>'html'], ['id'=>'\d+']);

//关键词： 路由分组
//管理员访问路由
Route::group('admin', function(){
    Route::any('login', 'admin/login/login', ['ext'=>'html']);
//后台商品列表
    Route::any('goods', 'admin/goods/index', ['ext'=>'html']);
//后台商品新增
    Route::get('goods_create', 'admin/goods/create', ['ext'=>'html']);
//后台商品新增->保存
    Route::post('goods_save', 'admin/goods/save', ['ext'=>'html']);
//后台商品修改
    Route::get('goods_edit/:id', 'admin/goods/edit', ['ext'=>'html'], ['id'=>'\d+']);
//后台商品修改->保存
    Route::post('goods_update', 'admin/goods/update', ['ext'=>'html'], ['id'=>'\d+']);
//后台商品详情
    Route::get('goods_read/:id', 'admin/goods/read', ['ext'=>'html'], ['id'=>'\d+']);   //访问你地址http://www.tpshop.com/admin/goods_read_150.html
    Route::get('goods_read_<id>', 'admin/goods/read', ['ext'=>'html'], ['id'=>'\d+']);  //访问地址http://www.tpshop.com/admin/goods_read_150.html  关键词组合变量
// Route::rule('goods_read/:id', 'admin/goods/read', 'GET', ['ext'=>'html'], ['id'=>'\d+']);   //效果一样
//后台商品删除
    Route::get('goods_delete/:id', 'admin/goods/delete', ['ext'=>'html'], ['id'=>'\d+']);
});

//用户访问路由
Route::group('home', function(){

});